package com.seashell;

import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;

/**
 * <ul>
 * <li>文件名称 : com.seashell.FileWriter
 * </li>
 * <li>版权所有 : 版权所有(C)2016-2020</li>
 * <li>公 司 : CST</li>
 * <li>创建时间 : 2017/1/17</li>
 * <li>修改记录 : </li>
 * </ul>
 * 类说明：
 *
 * @author Allen
 * @version 1.0
 */
public class FileWriter {

    File file;

    BufferedWriter writer;

    public FileWriter(String excelName,int fileIndex) throws IOException {
        file = new File(excelName+"_sql_"+fileIndex);
        if(file.exists()){
            throw new RuntimeException();
        }
        writer = new BufferedWriter(new java.io.FileWriter(file));
    }

    public void write(String str) throws IOException {
        writer.write(str);
        writer.newLine();
    }

    public void completeWrite() throws IOException {
        writer.flush();
        writer.close();
    }

}
